package org.jingouzhui.domain.strategy.model.valboj;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.jingouzhui.domain.strategy.service.rule.filter.factory.DefaultLogicFactory;
import org.jingouzhui.types.common.Delimiter;

import java.util.Arrays;

/**
 * @description:抽奖策略规则规则值对象；值对象，没有唯一ID，仅限于从数据库查询对象
 * @author: jingouzhui
 * @date: 2025/4/28 16:05
 */
@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class StrategyAwardRuleModelVO {

    private String ruleModels;

    public String[] centerRuleModels(){
        return Arrays.stream(ruleModels.split(Delimiter.COMMA)).filter(DefaultLogicFactory.LogicModel::isCenter).toArray(String[]::new);
    }

    public String[] afterRuleModels(){
        return Arrays.stream(ruleModels.split(Delimiter.COMMA)).filter(DefaultLogicFactory.LogicModel::isAfter).toArray(String[]::new);
    }

}